home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Event;
- import java.awt.Graphics;
- import java.awt.Rectangle;
- import java.io.DataInputStream;
- import java.io.IOException;
-
- final class ColMedia extends ColObj {
- protected ColGrph m_colGraphicObj;
- private ColObjIntr[] m_colObj;
- private byte playType;
- private long[] m_delay;
- private int numItems;
- private long numTicks = 0L;
- private int curIndex;
- private boolean animationDone;
- private boolean muted;
- private boolean inDraw;
- public Rectangle m_bounds;
-
- public boolean EventProc(Event var1) {
- boolean var4 = false;
- if (var1 != null) {
- if (var1.key == 6969) {
- this.muted = true;
- var4 = true;
- }
-
- if (var1.key == 6970) {
- this.muted = false;
- var4 = true;
- }
-
- if (var1.key == 6971) {
- this.PlayClip();
- var4 = true;
- }
-
- if (var1.id == 502) {
- int var2 = (int)(((float)var1.x + this.m_colGraphicObj.m_xOrg * this.m_colGraphicObj.m_mag) / this.m_colGraphicObj.m_mag);
- int var3 = (int)(((float)var1.y + this.m_colGraphicObj.m_yOrg * this.m_colGraphicObj.m_mag) / this.m_colGraphicObj.m_mag);
- if (this.m_bounds.inside(var2, var3) && this.playType == 2) {
- this.PlayClip();
- var4 = true;
- }
- }
- }
-
- if (!this.animationDone && !var4 && !this.inDraw) {
- long var5 = System.currentTimeMillis();
- if (var5 > this.numTicks) {
- this.numTicks = System.currentTimeMillis() + this.m_delay[this.curIndex];
- Graphics var7 = this.m_colGraphicObj.m_appComp.getGraphics();
- this.inDraw = true;
- this.draw(var7);
- this.m_colGraphicObj.m_appComp.getToolkit().sync();
- var7.dispose();
- this.inDraw = false;
- if (!this.animationDone) {
- ++this.curIndex;
- if (this.curIndex == this.numItems) {
- this.curIndex = 0;
- if (this.playType > 1) {
- this.animationDone = true;
- }
-
- System.gc();
- }
- }
- }
- }
-
- return var4;
- }
-
- public ColMedia(DataInputStream var1, int var2, ColGrph var3, Graphics var4) throws IOException {
- super.cvObjNum = (long)var1.readInt();
- this.numItems = var1.readInt();
- this.playType = var1.readByte();
- if (this.playType == 2) {
- this.animationDone = true;
- }
-
- this.m_colGraphicObj = var3;
- this.m_delay = new long[this.numItems];
- this.m_colObj = new ColObjIntr[this.numItems];
- this.m_bounds = new Rectangle();
- this.m_bounds.y = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.x = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.height = (int)((float)var1.readInt() / 65536.0F);
- this.m_bounds.width = (int)((float)var1.readInt() / 65536.0F);
-
- for(int var5 = 0; var5 < this.numItems; ++var5) {
- this.m_colGraphicObj.m_appComp.showStatus("Reading animation media " + var5 + " of " + (this.numItems - 1));
- this.m_delay[var5] = (long)var1.readInt();
- this.m_colObj[var5] = var3.m_appComp.m_colDoc.ReadNextObj(var1);
- if (this.m_colObj[var5].getType() == 6) {
- }
- }
-
- this.numTicks = System.currentTimeMillis();
- }
-
- public void draw(Graphics var1) {
- if (this.m_colObj[this.curIndex].getType() == 16) {
- if (!this.muted) {
- ((ColSnd)this.m_colObj[this.curIndex]).PlayClip();
- return;
- }
- } else {
- this.m_colObj[this.curIndex].draw(var1);
- }
-
- }
-
- public void PlayClip() {
- this.animationDone = false;
- this.curIndex = 0;
- this.numTicks = System.currentTimeMillis();
- }
-
- public int getType() {
- return 14;
- }
-
- public Rectangle getBounds() {
- return this.m_bounds;
- }
- }
-